<template>
	<view class="page" @click="navgateTo(data)">
		<view class="box">
			<view class="resource-image">
				<u-image width="300rpx" height="300rpx" :src="data.littleImgUrl"></u-image>
			</view>
			<view class="textwrap">
				<view class="title">
					{{data.name}}
				</view>
				<view class="info">
					<view class="subject">
						学科:{{data.subjectName}}
					</view>
					<view class="size">
						大小:{{data.sizeInfo}}
					</view>
					<view class="uploader">
						{{data.creator}}
					</view>
					<view class="time">
						{{data.createTime}}
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		props: {
			data: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		methods: {
			navgateTo(data) {
				this.$u.route('pages/resource/resourceDetail/resourceDetail', {
					id: data.id
				});
			}
		},
		created() {
			this.imgSrc =
				`${this.$store.state.base_url}/system/loadImg?imgPath=${encodeURI(this.data.littleImgUrl)}&accessToken=${this.$store.state.access_token}`
		},
	}
</script>

<style lang="scss">
	.page {
		box-sizing: border-box;
		padding: 15rpx 0;
		display: flex;
		justify-content: center;
		align-items: center;

		.box {
			.resource-image {
				width: 100%;
				height: 100%;
				border-radius: 3px;
				overflow: hidden;

				image {
					width: 300rpx;
					height: 300rpx;
				}
			}

			.textwrap {
				box-sizing: border-box;
				width: 300rpx;
				
				.title {
					height: 75rpx;
					display: -webkit-box;
					overflow: hidden;
					text-overflow: ellipsis;
					word-wrap: break-word;
					white-space: normal !important;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					color: #0067D1;
					font-weight: bold;
				}

				.info {
					color: gray;
					display: -webkit-box;
					overflow: hidden;
					text-overflow: ellipsis;
					word-wrap: break-word;
					white-space: normal !important;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}
			}

		}
	}
</style>
